﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CTP.Command;
using CTP.Entitys;
using System.Runtime.InteropServices;

namespace CTP
{
    [ComVisible(false)]
    public interface ICTPCallbackHandle
    {
        /// <summary>
        /// 当CTP接口产生异常时回调
        /// </summary>
        /// <param name="result"></param>
        /// <param name="requestID"></param>        
        void OnError(ReturnInfo result, int requestID);

        /// <summary>
        /// 资金帐号登陆回调
        /// </summary>
        void OnLogin(ReturnInfo result, LoginInfo loginInfo, int requestId);

        /// <summary>
        /// 资金帐号登出回调
        /// </summary>
        void OnLogout(ReturnInfo result, string tradingAccount, int requestId);

        /// <summary>
        /// 资金帐号登陆回调
        /// </summary>
        void OnLoginQoute(ReturnInfo result, LoginInfo loginInfo, int requestId);

        /// <summary>
        /// 资金帐号登出回调
        /// </summary>
        void OnLogoutQoute(ReturnInfo result, string tradingAccount, int requestId);

        /// <summary>
        /// 查询帐户概览响应
        /// </summary>
        void OnAccountSummary(ReturnInfo result, AccountInformation summary, int requestId);

        /// <summary>
        /// 委托单状态回报
        /// </summary>
        void OnOrderStatus(ReturnInfo result, OrderStatus ord, int requestId);

        /// <summary>
        /// 成交回报(分笔)
        /// </summary>
        void OnOrderFilled(ReturnInfo result, OrderReport ord);

        /// <summary>
        /// 查结算信息响应
        /// </summary>
        void OnQuerySettlementInfo(ReturnInfo result, SettlementInfoConfirm confirmInfo, int requestId);

        /// <summary>
        /// 确认结算信息响应
        /// </summary>
        void OnConfirmSettlementInfo(ReturnInfo result, int requestId);

        /// <summary>
        /// 推送持仓
        /// </summary>
        void OnPosition(ReturnInfo result, PositionInformation[] positions, int requestId);

        /// <summary>
        /// 推送当日委托
        /// </summary>
        void OnQueryOrder(ReturnInfo result, Order[] orders, int requestId);

        /// <summary>
        /// 推送历史委托
        /// </summary>
        void OnHistoricalOrder(ReturnInfo result, Order[] orders, int requestId);

        /// <summary>
        /// 推送当日成交记录
        /// </summary>
        void OnQueryFilled(ReturnInfo result, OrderReport[] orders, int requestId);

        /// <summary>
        /// 推送历史成交记录
        /// </summary>
        void OnHistoricalFilled(ReturnInfo result, OrderReport[] orders, int requestId);

        /// <summary>
        /// 推送行情
        /// </summary>
        void OnQoute(QouteInfo qouteInfo);
    }
}
